package com.bawei.base

import android.app.Application
import android.content.Context
import com.alibaba.android.arouter.launcher.ARouter
import com.tencent.mmkv.MMKV

/**
 * Author: Jason Zhang
 * Date: 2024/12/11
 * Desc: App基类
 */
open class BaseApplication: Application() {

    lateinit var appContext: Context

    override fun attachBaseContext(base: Context?) {
        super.attachBaseContext(base)
        if (base != null) {
            appContext = base
        }
    }

    override fun onCreate() {
        super.onCreate()

        //开启调试模式
        if (BuildConfig.DEBUG){
            ARouter.openLog()
            ARouter.openDebug()
        }

        //初始化ARouter
        ARouter.init(this)

        //初始化MMKV
        MMKV.initialize(this)

    }

    override fun onLowMemory() {
        super.onLowMemory()
    }

    override fun onTrimMemory(level: Int) {
        super.onTrimMemory(level)
    }

    override fun onTerminate() {
        super.onTerminate()
    }

}